package com.tony.pmp.server.config;

import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created with IntelliJ IDEA.
 *
 * @Title: MybatisPlusConfig
 * @Auther: 皮蛋布丁
 * @Date: 2021/07/15/22:22
 * @Description: Mybatis-plus配置
 */
@Configuration
public class MybatisPlusConfig {

    /**
    * @Description: paginationInterceptor 分页插件
    * @Param: []
    * @return: com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
    * @Author: 皮蛋布丁
    * @Date: 2021/7/15 22:23
    */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

    /**
    * @Description: sqlInjector 防sql注入攻击
    * @Param: []
    * @return: com.baomidou.mybatisplus.core.injector.ISqlInjector
    * @Author: 皮蛋布丁
    * @Date: 2021/7/15 22:24
    */
    @Bean
    public ISqlInjector sqlInjector() {
        return new LogicSqlInjector();
    }
}
